package com.base.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.base.comm.CommContent;
import com.base.po.voip.Helpers;
import com.base.service.HelpersService;
import com.base.service.LogsService;
import com.base.utils.IP;

/**
 * 修改反馈中心信息服务端
 * 
 * @author f
 *
 */
@Controller
@RequestMapping("/admin")
public class update_Help {

	@Autowired
	private LogsService logsService; // log日志
	@Autowired
	private HelpersService helpersService; // 反馈信息

	// 修改反馈中心
	@RequestMapping(value = "/toUpdateHelp", method = RequestMethod.POST)
	public @ResponseBody int toUpdateHelp(HttpServletRequest request, String id, Helpers helpers) throws Exception {
		if (request.getSession().getAttribute("adminUserId") == null) return -1; // 未登录
		logsService.insert(CommContent.TYPE_UPDATE, CommContent.LOGS_UPDATE + "改动反馈中心信息", (String) request.getSession().getAttribute("userNick"), true,
				IP.getIpAddr(request)); // 记录修改日志
		return helpersService.updateByPrimaryKeySelective(helpers); // 修改
	}
}
